package PagePackage;

import static org.testng.AssertJUnit.assertEquals;

import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;

import LoginPackage.TestBaseClass;
import PagePackage.MyPageFactory;
public class internalPageClass extends anyPageClass {

	@FindBy (xpath="html/body/div/header/nav/menu/li[1]/a") 
	public WebElement userstab;
	
	@FindBy (xpath="html/body/div/header/nav/menu/li[2]/a")
	public WebElement teamstab;
	
	@FindBy (xpath="html/body/div/header/nav/menu/li[3]/a")
	public WebElement schooltab;
	
	@FindBy (className="dropdown-toggle")
	public WebElement arrow;
	
	@FindBy (className="role-name")
	public WebElement roleName;
	
	@FindBy (className="icon-signout")
	public WebElement logoutButton;

	
	public teamsPage clickteamtab() {
		teamstab.click();
		return MyPageFactory.getPage(driver, teamsPage.class);
	}
	
	
	

	public usersPageClass clickusertab() {
		userstab.click();
		return MyPageFactory.getPage(driver, usersPageClass.class);
	}
	public schoolsPage clickschooltab() {
		schooltab.click();
		return MyPageFactory.getPage(driver, schoolsPage.class);
	}
	public internalPageClass goToInternalPage2() {
		driver.get("https://www-dev.krossover.com/intelligence-qa/teams"); 
		driver.manage().window().maximize();
		
		return MyPageFactory.getPage(driver, internalPageClass.class);
	}
	public loginPageClass logout() {
		driver.get("https://www-dev.krossover.com/intelligence-qa/account");
		arrow.click();
		logoutButton.click();
		
		return MyPageFactory.getPage(driver, loginPageClass.class);
	}
	public boolean isOnThisPage(){
		return arrow.isDisplayed(); 
	}
	
	@Override
	void tryToOpen() {
		goToInternalPage2()
		   .logout()
		   .loginAs("victoria@krossover.com", "webmaster");
		  
		
	}
	

}
